package com.zl.codereview.util;

import javax.swing.*;
import java.util.function.Supplier;

public class JOptionPaneUtils {

    public static void execute(String msg,Supplier supplier){
        int result = JOptionPane.showConfirmDialog(null, "您确定要进行这个操作吗?", "确认", JOptionPane.YES_NO_OPTION);
        // 根据用户的选择执行不同的操作
        if (result == JOptionPane.YES_OPTION) {
            supplier.get();
        }
    }

    public static void warn(String msg){
        JOptionPane.showMessageDialog(null, msg);
    }
}
